"""
@Time ： 2021/11/17 18:15
@Auth ： ChenZhangKun
"""
import socket


def main():
    # chuan
    udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    # 绑定
    udp_socket.bind(("", 8080))
    # 绑定端口
    receive_data = udp_socket.recvfrom(1024)
    print(receive_data[0].decode("utf-8"))
    # 发送消息
    udp_socket.sendto("我收到了谢谢".encode("utf-8"), (receive_data[1]))


if __name__ == '__main__':
    main()
